﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core;
using COFE.Core.Utils;
using COFE.Core.Profile;
using COFE.Core.Filter;

namespace COFE.Core.Lister
{
    /// <summary>
    /// list entries in a directory in a filesystem.
    /// </summary>
    public interface IDirectoryLister : IProduct<IDirectoryLister>
    {
        /// <summary>
        /// Set by the parent manager.
        /// </summary>
        string ListerKey { get; set; }

        /// <summary>
        /// Return a list of subentries
        /// </summary>
        /// <param name="parent">Parent of the entries.</param>
        /// <param name="filters">Return if one of the filters return true on match.</param>
        /// <returns></returns>
        IEnumerable<IFileSystemInfo> List(IInternalDirectoryInfoExA parent, EntryConstructionFlags flags);

        /// <summary>
        /// Get parent folder of an entries.
        /// </summary>
        IInternalDirectoryInfoExA GetParent(IInternalFileSystemInfoExA entry);

        /// <summary>
        /// Construct the virtual file / directory in temp path. 
        /// </summary>
        void Expand(IInternalFileSystemInfoExA item);

        /// <summary>
        /// If sequence matters and not based on FileName (e.g. Bookmarks), GetPosition is used.
        /// Return -1 if not supported (use FileName to sort)
        /// </summary>
        int GetPosition(IInternalFileSystemInfoExA item);

        /// <summary>
        /// Change position 
        /// </summary>
        void SetPosition(IInternalFileSystemInfoExA item, int position);

        /// <summary>
        /// Create a new instance of DirectoryController.
        /// </summary>
        /// <returns></returns>
        IDirectoryController CreateController();

        /// <summary>
        /// Create a new instance of StreamProvider for a file.
        /// </summary>        
        IStreamProvider CreateStreamProvider();
    }
}
